//
//  MoodRootViewController.m
//  Today
//
//  Created by dllo on 15/5/29.
//  Copyright (c) 2015年 fanfan. All rights reserved.
//

#import "MoodRootViewController.h"

@interface MoodRootViewController ()

@end

@implementation MoodRootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [MoodDataBaseTool openMoodDB];
    [MoodDataBaseTool createMoodDB];
    
    self.view.backgroundColor = [UIColor greenColor];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    UIImage *image = [UIImage imageNamed:@"dashu.jpg"];
    imageView.image = image;
    [self.view addSubview:imageView];
    imageView.userInteractionEnabled = YES;
    [imageView release];
    
    self.view.backgroundColor = [UIColor greenColor];
    
    UIButton *buttonWrite = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonWrite.frame = CGRectMake(0, 100, 100, 100);
    buttonWrite.backgroundColor = [UIColor clearColor];
    [buttonWrite setTitle:@"写日记" forState:UIControlStateNormal];
    [buttonWrite addTarget:self action:@selector(touchWrite) forControlEvents:UIControlEventTouchUpInside];
    [imageView addSubview:buttonWrite];
    
    UIButton *buttonLook = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonLook.frame = CGRectMake(100, 200, 100, 100);
    buttonLook.backgroundColor = [UIColor clearColor];
    [buttonLook setTitle:@"查看日记" forState:UIControlStateNormal];
    [buttonLook addTarget:self action:@selector(touchLook) forControlEvents:UIControlEventTouchUpInside];
    [imageView addSubview:buttonLook];
    
    UIButton *buttonLookCollect = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonLookCollect.frame = CGRectMake(200, 300, 100, 100);
    buttonLookCollect.backgroundColor = [UIColor clearColor];
    [buttonLookCollect setTitle:@"收藏日记" forState:UIControlStateNormal];
    [buttonLookCollect addTarget:self action:@selector(touchLookCollect) forControlEvents:UIControlEventTouchUpInside];
    [imageView addSubview:buttonLookCollect];
    
    //imageview图片等比例填充
    //imageview.contentMode = UIViewContentModeScaleAspectFit;
    
    
    
    // Do any additional setup after loading the view.
}

- (void)touchWrite
{
    MoodFirstViewController *first = [[MoodFirstViewController alloc] init];
    [self.navigationController pushViewController:first animated:YES];
    [first release];
    
}

- (void)touchLook
{
    MoodViewController *mood = [[MoodViewController alloc] init];
    [self.navigationController pushViewController:mood animated:YES];
    [mood release];
}

- (void)touchLookCollect
{
    MoodCollectViewController *collect = [[MoodCollectViewController alloc] init];
    [self.navigationController pushViewController:collect animated:YES];
    [collect release];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
